home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Draw / Sources / FloatFrm.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.6 KB  |  130 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FloatFrm.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "ODFDraw.hpp"
  13.  
  14. #ifndef FLOATFRM_H
  15. #include "FloatFrm.h"
  16. #endif
  17.  
  18. #ifndef DRAWPART_H
  19. #include "DrawPart.h"
  20. #endif
  21.  
  22. // ----- Part Layer -----
  23.  
  24. #ifndef FWUTIL_H
  25. #include "FWUtil.h"
  26. #endif
  27.  
  28. // ----- OS Layer -----
  29.  
  30. #ifndef FWRECSHP_H
  31. #include "FWRecShp.h"
  32. #endif
  33.  
  34. #ifndef FWWINDOW_H
  35. #include "FWWindow.h"
  36. #endif
  37.  
  38. // ----- Foundation Layer -----
  39.  
  40. #ifndef FWDEBUG_H
  41. #include "FWDebug.h"
  42. #endif
  43.  
  44. //========================================================================================
  45. // Runtime Information
  46. //========================================================================================
  47.  
  48. #ifdef FW_BUILD_MAC
  49. #pragma segment odfdrawframes
  50. #endif
  51.  
  52. //========================================================================================
  53. // CLASS CFloatingWindowFrame
  54. //========================================================================================
  55.  
  56. //----------------------------------------------------------------------------------------
  57. // CFloatingWindowFrame::CFloatingWindowFrame
  58. //----------------------------------------------------------------------------------------
  59.  
  60. CFloatingWindowFrame::CFloatingWindowFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, CDrawPart *drawPart) :
  61.     FW_CFrame(ev, odFrame, presentation, drawPart),
  62.     fDrawPart(drawPart),
  63.     fFacet(NULL),
  64.     fMapping(FW_kDevice)
  65. {
  66.     SetCanBeActiveFrame(ev, FALSE);
  67. }
  68.  
  69. //----------------------------------------------------------------------------------------
  70. // CFloatingWindowFrame::~CFloatingWindowFrame
  71. //----------------------------------------------------------------------------------------
  72.  
  73. CFloatingWindowFrame::~CFloatingWindowFrame()
  74. {
  75. }
  76.  
  77. //----------------------------------------------------------------------------------------
  78. // CFloatingWindowFrame::FacetAdded
  79. //----------------------------------------------------------------------------------------
  80.  
  81. void CFloatingWindowFrame::EraseBackground(Environment* ev, FW_CFacetContext& fc)
  82. {    
  83.     FW_CRect rect;
  84.     fc.GetClipRect(rect);
  85.     FW_PInk ink(FW_kRGBLightGray);
  86.     FW_CRectShape::RenderRect(fc, rect, FW_kFill, ink);
  87. }
  88.  
  89. //----------------------------------------------------------------------------------------
  90. // CFloatingWindowFrame::FacetAdded
  91. //----------------------------------------------------------------------------------------
  92.  
  93. void CFloatingWindowFrame::FacetAdded(Environment* ev, ODFacet* facet)
  94. {
  95.     FW_CFrame::FacetAdded(ev, facet);
  96.     
  97.     FW_ASSERT(fFacet == NULL);    // we know we can't have more than one facet
  98.     fFacet = facet;
  99. }
  100.  
  101. //----------------------------------------------------------------------------------------
  102. // CFloatingWindowFrame::FacetRemoved
  103. //----------------------------------------------------------------------------------------
  104.  
  105. void CFloatingWindowFrame::FacetRemoved(Environment* ev, ODFacet* facet)
  106. {
  107.     FW_ASSERT(facet == fFacet);    // we know we can't have more than one facet
  108.     fFacet = NULL;
  109.  
  110.     // ----- Call inherited -----
  111.     FW_CFrame::FacetRemoved(ev, facet);    
  112. }
  113.  
  114. //----------------------------------------------------------------------------------------
  115. // CFloatingWindowFrame::HideShowFloating
  116. //----------------------------------------------------------------------------------------
  117.  
  118. void CFloatingWindowFrame::HideShowFloating(Environment* ev)
  119. {
  120.     FW_CWindow *window = GetWindow(ev);
  121.     
  122.     if (window->IsShown(ev))
  123.         window->Hide(ev);
  124.     else
  125.         window->Show(ev);    
  126. }
  127.  
  128.  
  129.  
  130.